package com.yixun.qfbao.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Map;

@ApiModel
public class CommonResponse implements Serializable {
    private static final long serialVersionUID = -8349696635548886541L;
    @ApiModelProperty(
            value = "响应码,1表示成功. 2表示为重复点击",
            example = "1"
    )
    private String code;
    @ApiModelProperty("响应消息")
    private String msg;
    @ApiModelProperty(
            value = "自定义错误数据map",
            example = "${name}${age}${test}"
    )
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Map<String, Object> errorMap;

    public Map<String, Object> getErrorMap() {
        return this.errorMap;
    }

    public void setErrorMap(Map<String, Object> errorMap) {
        this.errorMap = errorMap;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public CommonResponse() {
        this.code = ResultEnum.SUCCESS.getNo();
        this.msg = ResultEnum.SUCCESS.getDes();
    }

    public CommonResponse(String responseCode, String responseMessage) {
        this.code = ResultEnum.SUCCESS.getNo();
        this.msg = ResultEnum.SUCCESS.getDes();
        this.code = responseCode;
        this.msg = responseMessage;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
